<html>
<head><meta charset="utf-8"><title>adding `--emit check` · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/adding.20.60--emit.20check.60.html">adding `--emit check`</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="239035495"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/adding%20%60--emit%20check%60/near/239035495" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Fitzhardinge <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/adding.20.60--emit.20check.60.html#239035495">(May 17 2021 at 05:26)</a>:</h4>
<p>I posed <a href="https://internals.rust-lang.org/t/rfc-emit-check/14711">https://internals.rust-lang.org/t/rfc-emit-check/14711</a> about this, but the TL;DR is that I'm proposing making <code>--emit metadata</code> always include full mir info as .rmeta, and adding <code>--emit check</code> for a mir-less .rcheck file.</p>
<p>But that assumes there's a large perf hit from always including mir - but from my benchmarks of running <code>cargo check</code> on cargo itself showed that there was only ~8% difference. That's not nothing, but it doesn't seem enough to justify lots of complexity. If the primary concern is turnaround latency, that doesn't seem all that significant.  But maybe cargo is just a bad example - does anyone have some examples where always including mir in rmeta would be very expensive over not?</p>



<a name="239052180"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/adding%20%60--emit%20check%60/near/239052180" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> hyd-dev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/adding.20.60--emit.20check.60.html#239052180">(May 17 2021 at 08:37)</a>:</h4>
<p>I'm pretty sure <code>--emit metadata</code> omits more data than MIR. I was recently bugged that <code>exported_symbols()</code> always returns empty result if <code>!tcx.sess.opts.output_types.should_codegen()</code>.</p>



<a name="239052752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/adding%20%60--emit%20check%60/near/239052752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> tm <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/adding.20.60--emit.20check.60.html#239052752">(May 17 2021 at 08:42)</a>:</h4>
<p>Empty <code>reachable_non_generics</code> would be another example. In <a href="https://github.com/rust-lang/rust/issues/85401">#85401</a> MIR being missing is one thing, but the error arises in the first place because crate bar attempts to codegen static from crate foo (because <code>should_codegen()</code> was false when it was built).</p>



<a name="239143562"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/adding%20%60--emit%20check%60/near/239143562" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Fitzhardinge <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/adding.20.60--emit.20check.60.html#239143562">(May 17 2021 at 19:07)</a>:</h4>
<p>@tm In general <code>-Zalways-encode-mir=yes</code> works surprisingly well - I managed to build quite a large portion of my target codebase with rmeta until I ran into <a href="https://github.com/rust-lang/rust/issues/85401">#85401</a>. Without that <code>static</code> the small example works fine, but I certainly won't be surprised if I run into another case. It definitely looks like I'm treading in uncommon pathways (<a href="https://github.com/rust-lang/rust/issues/85356">#85356</a> for a more mundane example).</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>